<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/21
 * Time: 9:20
 */
//var_dump($_GET);
//var_dump($_POST);
$mobile = $_POST['a'];
//$m = "121231231\nasdfasd\nasdfasd\nasdfasd\nasdfasd\nasdfasd\nasdfasd\nasdfasd32\n";
//转义字符在双引号中，可以被解析，在单引号中不能被解析。
//echo $m;
var_dump($mobile);
$arr = explode("\n",$mobile);
var_dump($arr);

foreach($arr as $m){
    $m = trim($m);
    if (preg_match('/^(13|15|18|17|19)[0-9]{9}$/',$m)){
//    $s1 = substr_replace($mobile,"****",3,4);
        $s1 = preg_replace('/(\d{3})(\d{4})(\d{4})/',"$1****$3",$m);
        echo $s1."<br>";
    } else{
        echo "mobile is wrong<br>";
    }

}